<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    		<form class="form-horizontal" action="/article/save" method="post" id="articleForm">
		    <fieldset>
		    <div id="legend" class="">
        		<legend class="">提交文章</legend>
      		</div>
		    <div class="control-group">
				<input type="hidden" value="${article.id }" name="id">
		          <label class="control-label" for="input01">标题：</label>
		          <div class="controls">
		            <input type="text" placeholder="" class="input-xlarge" name="title" value="${article.title }">
		            <p class="help-block"></p>
		          </div>
		        </div>
		
		    	<div class="control-group">
		          <label class="control-label" for="input01">作者：</label>
		          <div class="controls">
		            <input type="text" placeholder="" class="input-xlarge" name="author" value="${article.author }">
		            <p class="help-block"></p>
		          </div>
		        </div>
		        
		        <div class="control-group">
		          <label class="control-label" for="input01">分类：</label>
		          <div class="controls">
		            	<select name="category" id="category">
		            		<option value="0">无</option>
		            		<option value="1">魔兽世界私服信息</option>
		            		<option value="2">魔兽私服相关信息</option>
		            		<option value="3">魔兽世界相关信息</option>
		            	</select>
		            <p class="help-block"></p>
		          </div>
		        </div>
		        
		    <div class="control-group">
				<input id="detail" name="detail" type="hidden">
		          <!-- Textarea -->
		          <label class="control-label">文章内容：</label>
		          <div class="controls">
		            	<script  id="editor" type="text/plain">${article.detail}</script>
		          </div>
		    </div>
		 	<div class="control-group">
		
		          <div class="controls">
		           
		            <button type="submit" class="btn" onclick="setVal();">提交</button>
		          </div>
		        </div>
		    </fieldset>
  			</form>
<script src="${resourceRoot }/third-party/ueditor/editor_config.js"></script>
<script src="${resourceRoot }/third-party/ueditor/editor_all_min.js"></script>
<script type="text/javascript">
var editor = UE.getEditor('editor',{
   	initialFrameWidth:600,
    initialFrameHeight:400

});


 $(document).ready(function() {
  	$("#articleForm").validate({
		rules: {
			title: {required:true,maxlength:30},
			author: {required:true,maxlength:10}
		},
		messages: {
			title: {required:"请填写标题",maxlength:"标题不能长于30个字"},
			author: {required:"请填写作者",maxlength:"不能长于10个字"}
			}
		});
  	$('#articleForm').ajaxForm({
		beforeSubmit:function(){
			return $('#articleForm').validate().form();
		},
		success:function(){
			$('#div_right').load("/article/manage");
		}
	});
  	
  	$('#category').val(${article.category});
 });
function setVal() {  
	$("#detail").val(editor.getContent()); 
}  
</script>
